/*
 * Copyright 2011 The Rusted Roof, LLC.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package org.proteusframework.api;

import org.proteusframework.api.config.IConfigurationLoader;

/**
 * Minimal definition of a Proteus Application.
 *
 * @author Tacoma Four
 */
public interface IProteusApplication extends IPlatformDelegate
{
    /**
     * Injects a {@link IRuntimeEngine} into the Proteus application.
     *
     * @param engine Runtime engine
     */
    void setRuntimeEngine(IRuntimeEngine engine);

    /**
     * Creates a default configuration loader, as defined by the application. In the case of the
     * {@link org.proteusframework.runtime.StandardProteusApplication}, the default configuration loader is an instance
     * of {@link org.proteusframework.runtime.StandardConfigurationLoader} which reads key-value pairs from any valid
     * .properties file passed as the input stream.
     *
     * @return Configuration loader
     */
    IConfigurationLoader createConfigurationLoader();

    /**
     * Typically, invokes {@link org.proteusframework.api.IRuntimeEngine#run()}; this is the default behavior found in
     * {@link org.proteusframework.runtime.StandardProteusApplication}. The framework, by design, does not spawn a
     * thread; it is the implementors responsibility to spawn a thread, as appropriate.
     */
    void startApplication();
}
